Purpose:: Note that for each graph requested and presented, this is simply where I stopped messing with them. Most have them have one or more things about them that can be improved, so if you like the output of one but not aspects of styling it will be most time-efficient to focus on improving those (rather than try to perfect every one before showing where I’m at)

Response Time for All responses (Inacc and Acc), Switch/Nonswitch

#Switch Trials Spaghetti Plot
xyplot(logRT_mean~Session, groups=Subject, subset=Switch=="switch", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Switch Response Time", auto.key = TRUE)

#Non-Switch Spaghetti Plot
xyplot(logRT_mean~Session, groups=Subject, subset=Switch=="nonswitch", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Non-switch Response Time", auto.key = TRUE)

#By session
xyplot(logRT_mean~Switch|Session, groups=Subject, 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Response Time by Session", auto.key = TRUE)

#Spaghetti plot line for each subject and Direction
xyplot(logRT_mean~Session, groups=c(Subject, Switch), N_switch_stats_bysub_bysession, 
       type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, 
       ylab="Response Time", auto.key = TRUE) 

#the lines intersect creating a third line that is meaningless

#plot Subject 1
xyplot(logRT_mean~Session, groups=Switch, subset=Subject=="50142", 
       N_switch_stats_bysub_bysession, type=c('p','l'), 
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Mean RT Subject 1", auto.key = TRUE)

#plot Sub 2
xyplot(logRT_mean~Session, groups=Switch, subset=Subject=="50192", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Mean RT Subject 2", auto.key = TRUE)

#plot Sub 3
xyplot(logRT_mean~Session, groups=Switch, subset=Subject=="50202", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Mean RT Subject 3", auto.key = TRUE)

#Plot Sub 4
xyplot(logRT_mean~Session, groups=Switch, subset=Subject=="50262", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Mean RT Subject 4", auto.key = TRUE)

#Plot Sub 5
xyplot(logRT_mean~Session, groups=Switch, subset=Subject=="50312", 
       N_switch_stats_bysub_bysession, type=c('p', 'l'), 
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Mean RT Subject 5", auto.key = TRUE)

#Plot Overall Spaghetti
xyplot(logRT_mean~Session, groups=Switch, subset=Subject=="Overall", 
       N_switch_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Overall RT", auto.key = TRUE) 

mypanel=function(x,y,h){
  panel.xyplot(x, y, lty=1, type=c('p', 'l'))
  panel.lmline(x, y, lty=3, lwd=1, col="purple")
  panel.grid(h=-1, v=-1)
  panel.abline(mean(h), lty=2, col="red")
  llines(x, y, col=c("blue", "green"))
}
colors=c("blue", "green")
keylist=list(space="top", col=c("blue", "green", "red", "purple"), 
             columns=1, text=c("Inv", "Up", "Mean", "Regression"))
bysubjectN=factor(N_switch_stats$Subject, levels = c(1,2,3,4,5), 
                  labels = c("1", "2", "3", "4", "5"))
xyplot(logRT_mean~Session|bysubjectN, groups=Switch, data=N_switch_stats, 
       h=N_switch_stats$logRT_mean, layout=c(5,1), aspect=1.5, 
       main="Subject Response Times Switch v NonSwitch", xlab="RT (ms)", 
       ylab="Session", panel=mypanel, auto.key=keylist)

Responses Over Time

#Time 1
#ggplot(data=F_N_T2T1_all, subset=c(Subject=="50142" & Session=="1", aes(logRT~Trial) +geom_line()))
levels(NT1Plots$Subject)
## [1] "50142" "50192" "50202" "50262" "50312"
xyplot(logRT~Trial, groups=Switch, subset=Subject=="50142", data=NT1Plots, 
       type='l', ylim = (5.5:8.5), main="Subject1, Session 1 RT", 
       auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50192", data=NT1Plots, 
       type='l', ylim = (5.5:8.5), main="Subject2, Session 1 RT", 
       auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50202", data=NT1Plots, 
       type='l', ylim = (5.5:8.5), main="Subject2, Session 1 RT", 
       auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50262", data=NT1Plots, 
       type='l', ylim = (5.5:8.5), main="Subject2, Session 1 RT", 
       auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50312", data=NT1Plots, 
       type='l', ylim = (5.5:8.5), main="Subject2, Session 1 RT", 
       auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Subject, data=NT1Plots, type="a", ylim=(5.5:8.5), 
       main="Session 1 Response Times by Subject", 
       auto.key = list(space='top'), xlim=(1:130), x.scales=10)

#Time 2
xyplot(logRT~Trial, groups=Switch, subset=Subject=="50142", data=NT2Plots, type='l', ylim = (3:10), 
       main="Subject1, Session 2 RT", auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50192", data=NT2Plots, type='l', ylim = (3:10), 
       main="Subject2, Session 2 RT", auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50202", data=NT2Plots, type='l', ylim = (3:10), 
       main="Subject2, Session 2 RT", auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50262", data=NT2Plots, type='l', ylim = (3:10), 
       main="Subject2, Session 2 RT", auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Switch, subset=Subject=="50312", data=NT2Plots, type='l', ylim = (3:10), 
       main="Subject2, Session 2 RT", auto.key = list(space="top"), xlim=(1:130), x.scales=10)

xyplot(logRT~Trial, groups=Subject, data=NT1Plots, type="a", ylim=(3:10), main="Session 2 Response Times by Subject", auto.key = list(space='top'), xlim=(1:130), x.scales=10)

##Response Times, only ACCURATE responses, Switch/Nonswitch

#Switch Trials Spaghetti Plot
xyplot(logRT_mean~Session, groups=Subject, subset=Switch=="switch", 
       N2_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Switch Response Time", auto.key = TRUE)

#Non-Switch Spaghetti Plot
xyplot(logRT_mean~Session, groups=Subject, subset=Switch=="nonswitch", 
       N2_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, 
       main="Non-switch Response Time", auto.key = TRUE)

#By session
xyplot(logRT_mean~Switch|Session, groups=Subject, N2_switch_stats_bysub_bysession, 
       type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, 
       main="Response Time by Session", auto.key = TRUE, alternate=FALSE)

#Spaghetti plot line for each subject and Direction
xyplot(logRT_mean~Session, groups=c(Subject, Switch), N2_switch_stats_bysub_bysession, 
       type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Response Time", auto.key = TRUE)

#Spaghetti plot line for each subject and Direction
xyplot(logRT_mean~Session, groups=c(Subject, Switch), N2_switch_stats_bysub_bysession, 
       type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Response Time", auto.key = TRUE)

#with regression and mean line as panels
mypanel=function(x,y,h){
  panel.xyplot(x, y, lty=1, type=c('p', 'l'))
  panel.lmline(x, y, lty=3, lwd=1, col="purple")
  panel.grid(h=-1, v=-1)
  panel.abline(mean(h), lty=2, col="red")
  llines(x, y, col=c("blue", "green"))
}
colors=c("blue", "green")
keylist=list(space="top", col=c("blue", "green", "red", "purple"), 
             columns=1, text=c("Inv", "Up", "Mean", "Regression"), points=FALSE)
bysubjectN2=factor(N2_switch_stats$Subject, levels = c(1,2,3,4,5), 
                  labels = c("1", "2", "3", "4", "5"))
xyplot(logRT_mean~Session|bysubjectN2, groups=Switch, data=N2_switch_stats, 
       h=N2_switch_stats$logRT_mean, layout=c(5,1), aspect=1.5, 
       main="Subject Response Times Switch v NonSwitch", xlab="RT (ms)", 
       ylab="Session", panel=mypanel, auto.key=keylist)

#still having trouble getting Up lines the correct color and not having the connecting line

Global/Local Processing, Response Times Using ALL responses

#Plot Target Location by Session
(ses1=xyplot(logRT_mean~TargetLocation, data=fn_tlocation_bysubj_bytime, groups=Subject, 
             subset=Session=="1", auto.key = list(space="right", columns=2), 
             type=c("p","l"), ylim = c(6,7),main="Session 1 RT by Location"))

(ses2=xyplot(logRT_mean~TargetLocation, data=fn_tlocation_bysubj_bytime, groups=Subject, 
             subset=Session=="2", auto.key=list(space="right"), type=c("p", "l"),
             ylim = c(6,7), pch=24, main="Session 2 RT by Location"))

#key=list(space="right", column=2, 
#         points=list(pch=c(21, 24), col=c("blue", "pink", "green", "red", "yellow")), 
#         text=c(levels(fn_tlocation_bysubj_bytime$Subject), 
#                levels(fn_tlocation_bysubj_bytime$Session)))
plot(ses2+ses1) 

#I want to learn to add symbols showing the triangles are session 2 and circles session 1 if desired
(glob=xyplot(logRT_mean~Session, data=fn_tlocation_bysubj_bytime, groups=Subject, 
             subset=TargetLocation=="G", auto.key = list(space="right"), 
             type=c("p","l"), ylim = c(6,7),main="RT, Global"))

(loc=xyplot(logRT_mean~Session, data=fn_tlocation_bysubj_bytime, groups=Subject, 
            subset=TargetLocation=="L", auto.key=list(space="right"), type=c("p", "l"),
            ylim = c(6,7), pch=24, main="RT, Local"))

#mycols=c("pink", "blue", "yellow", "brown", "light green")
plot(glob+loc, cols=cols, main="Global and Local Response Times by Session")# %>%

#  legend("right", legend = 
#         paste(c("1 Global", "2 Global","3 Global", "4 Global", "5 Global"), 
#               c("1 Local", "2 Local", "3 Local", "4 Local", "5 Local"), sep=";"), 
#       col=rep(cols, times=2), pch=rep(c(16, 24), each=5), bty="n", 
#       ncol=2, cex=.7, pt.cex = .7)
#key not functioning correctly nor is the title

#plot side by side session 1 and 2 glocal and local
xyplot(logRT_mean~Session|TargetLocation, data=fn_tlocation_bysubj_bytime, groups=Subject, auto.key =list(space="right"), type=c("p", "l"), main="Global and Local Processing by Session")

xyplot(logRT_mean~TargetLocation|Session, data=fn_tlocation_bysubj_bytime, groups=Subject, auto.key =list(space="right"), type=c("p", "l"), main="Global and Local Processing by Session")

#panels by subject with mean and regression
mypanel=function(x,y,h){
  panel.xyplot(x, y, lty=1, type=c('p', 'l'))
  panel.lmline(x, y, lty=3, lwd=1, col="purple")
  panel.grid(h=-1, v=-1)
  panel.abline(mean(h), lty=2, col="red")
  llines(x, y, col=c("blue", "green"))
}
colors=c("blue", "green")
Tlockeylist=list(space="top", col=c("blue", "green", "red", "purple"), 
             columns=1, text=c("Global", "Local", "Mean", "Regression"), points=FALSE)
bysubjectTloc=factor(fn_tlocation_stats$Subject, levels = c(1,2,3,4,5), 
                   labels = c("1", "2", "3", "4", "5"))
xyplot(logRT_mean~Session|bysubjectTloc, groups=TargetLocation, data=fn_tlocation_stats, 
       h=fn_tlocation_stats$logRT_mean, layout=c(5,1), aspect=1.5, 
       main="Subject Response Times Target Location", xlab="RT (ms)", 
       ylab="Session", panel=mypanel, auto.key=Tlockeylist)

Global/Local only Accurate Responses

#Plot Target Location by Session
(ses1_2=xyplot(logRT_mean~TargetLocation, data=fn2_tlocaiton_bysubj_bytime, groups=Subject, 
               subset=Session=="1", auto.key = list(space="right"), 
               type=c("p","l"), ylim = c(6,7),main="Session 1 RT by Location"))

(ses2_2=xyplot(logRT_mean~TargetLocation, data=fn_tlocation_bysubj_bytime, groups=Subject, 
               subset=Session=="2", auto.key=list(space="right"), 
               type=c("p", "l"), ylim = c(6,7), pch=24, main="Session 2 RT by Location"))

#key=list(space="right", column=2, points=list(pch=c(21, 24), col=c("blue", "pink", "green", "red", "yellow")), text=c(levels(fn_tlocation_bysubj_bytime$Subject), levels(fn_tlocation_bysubj_bytime$Session)) )
plot(ses2_2+ses1_2) 

#I want to learn to add symbols showing the triangles are session 2 and circles session 1 if desired
(glob_2=xyplot(logRT_mean~Session, data=fn_tlocation_bysubj_bytime, groups=Subject, 
               subset=TargetLocation=="G", auto.key = list(space="right"), 
               type=c("p","l"), ylim = c(6,7),main="RT, Global"))

(loc_2=xyplot(logRT_mean~Session, data=fn_tlocation_bysubj_bytime, groups=Subject, 
              subset=TargetLocation=="L", auto.key=list(space="right"), 
              type=c("p", "l"),ylim = c(6,7), pch=24, main="RT, Local"))

plot(glob_2+loc_2, main="Global and Local Response Times by Session") 

#key not functioning correctly nor is the title

#plot side by side session 1 and 2 glocal and local
xyplot(logRT_mean~Session|TargetLocation, data=fn2_tlocaiton_bysubj_bytime, groups=Subject, 
       auto.key =list(space="right"), type=c("p", "l"), main="Global and Local Processing by Session")

xyplot(logRT_mean~TargetLocation|Session, data=fn2_tlocaiton_bysubj_bytime, groups=Subject, 
       auto.key =list(space="right"), type=c("p", "l"), main="Global and Local Processing by Session")

#In panels by subj with mean and regression
mypanel=function(x,y,h){
  panel.xyplot(x, y, lty=1, type=c('p', 'l'))
  panel.lmline(x, y, lty=3, lwd=1, col="purple")
  panel.grid(h=-1, v=-1)
  panel.abline(mean(h), lty=2, col="red")
  llines(x, y, col=c("blue", "green"))
}
colors=c("blue", "green")
Tlockeylist=list(space="top", col=c("blue", "green", "red", "purple"), 
                 columns=1, text=c("Global", "Local", "Mean", "Regression"), points=FALSE)
bysubjectTloc=factor(fn_tlocation_stats$Subject, levels = c(1,2,3,4,5), 
                     labels = c("1", "2", "3", "4", "5"))
xyplot(logRT_mean~Session|bysubjectTloc, groups=TargetLocation, data=fn2_stats_tlocation, 
       h=fn2_stats_tlocation$logRT_mean, layout=c(5,1), aspect=1.5, 
       main="Subject Response Times Target Location", xlab="RT (ms)", 
       ylab="Session", panel=mypanel, auto.key=Tlockeylist)

##Accuracy, Switch and NonSwitch

#Switch Trials Spaghetti Plot
xyplot(Stimuli.ACC_mean~Session, groups=Subject, subset=Switch=="switch", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, main="Switch ACC", auto.key = TRUE)

#Non-Switch Spaghetti Plot
xyplot(Stimuli.ACC_mean~Session, groups=Subject, subset=Switch=="nonswitch", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, main="Non-switch ACC", 
       auto.key = TRUE)

#By session
xyplot(Stimuli.ACC_mean~Switch|Session, groups=Subject, N_switch_stats_bysub_bysession, 
       type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, main="ACC by Session", 
       auto.key = TRUE)

#Spaghetti plot line for each subject and Direction
xyplot(Stimuli.ACC_mean~Session, groups=c(Subject, Switch), N_switch_stats_bysub_bysession, 
       type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, ylab="ACC", auto.key = TRUE)

#plot Subject 1
xyplot(Stimuli.ACC_mean~Session, groups=Switch, subset=Subject=="50142", 
       N_switch_stats_bysub_bysession, type=c('p','l'), par.settings=ggplot2like(),
       axis=axis.grid, main="Mean ACC Subject 1", auto.key = TRUE)

#plot Sub 2
xyplot(Stimuli.ACC_mean~Session, groups=Switch, subset=Subject=="50192", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, main="Mean ACC Subject 2", auto.key = TRUE)

#plot Sub 3
xyplot(Stimuli.ACC_mean~Session, groups=Switch, subset=Subject=="50202", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, main="Mean ACC Subject 3", auto.key = TRUE)

#Plot Sub 4
xyplot(Stimuli.ACC_mean~Session, groups=Switch, subset=Subject=="50262", 
       N_switch_stats_bysub_bysession, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, main="Mean ACC Subject 4", auto.key = TRUE)

#Plot Sub 5
xyplot(Stimuli.ACC_mean~Session, groups=Switch, subset=Subject=="50312", 
       N_switch_stats_bysub_bysession, type=c('p', 'l'), 
       par.settings=ggplot2like(),axis=axis.grid, main="Mean RT Subject 5", auto.key = TRUE)

#Plot Overall Spaghetti
xyplot(Stimuli.ACC_mean~Session, groups=Switch, subset=Subject=="Overall", 
       N_switch_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, main="Overall ACC", auto.key = TRUE) 

xyplot(Stimuli.ACC_mean~Session, groups=c(Subject, Switch), N_switch_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Overall ACC", main="Overall", 
       auto.key = list(space="right"))

#Inv_stats_bysub_bydirection_bytime$tmpSubject=as.numeric(Inv_stats_bysub_bydirection_bytime$Subject)
#sidebyside=equal.count(Inv_stats_bysub_bydirection_bytime$tmpSubject, number=5, overlap=0)
mypanel=function(x,y,h){
  panel.xyplot(x, y, lty=1, type=c('p', 'l'))
  panel.lmline(x, y, lty=3, lwd=1, col="purple")
  panel.grid(h=-1, v=-1)
  panel.abline(mean(h), lty=2, col="red")
  llines(x, y, col=c("blue", "green"))
}
#xyplot(logRT_mean~Session|sidebyside, groups=Direction, data=Inv_stats_bysub_bydirection_bytime,  h=Inv_stats_bysub_bydirection_bytime$Stimuli.ACC_mean, layout=c(5,1), aspect=1.5, main="Subject ACC Inv v Up", xlab="ACC", ylab="Session", panel=mypanel, auto.key = list(space="top"))

colors=c("blue", "green")
keylist=list(space="top", col=c("blue", "green", "red", "purple"), columns=1, text=c("Inv", "Up", "Mean", "Regression"))
bysubjectN=factor(N_switch_stats$Subject, levels = c(1,2,3,4,5), labels = c("1", "2", "3", "4", "5"))
xyplot(Stimuli.ACC_mean~Session|bysubjectN, groups=Switch, data=N_switch_stats, 
       h=N_switch_stats$Stimuli.ACC_mean, layout=c(5,1), aspect=1.5, 
       main="Subject ACC Switch v NonSwitch", xlab="Session", ylab="ACC", panel=mypanel, 
       auto.key=keylist)

Accuracy Over Time

#Time 1
xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50142", data=NT1Plots, 
       type='l', main="Subject1, Session 1 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50192", data=NT1Plots, 
       type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50202", data=NT1Plots, 
       type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50262", data=NT1Plots, 
       type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50312", data=NT1Plots, 
       type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Subject, data=NT1Plots, type="a", 
       main="Session 1 ACC by Subject",xlim=(1:130), auto.key = list(space='top'), x.scales=10)

#Time 2
xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50142", data=NT2Plots, 
       type='l', main="Subject1, Session 2 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50192", data=NT2Plots, 
       type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50202", data=NT2Plots, 
       type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50262", data=NT2Plots, 
       type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Switch, subset=Subject=="50312", data=NT2Plots, 
       type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"), 
       xlim=(1:130), x.scales=10)

xyplot(Stimuli.ACC~Trial, groups=Subject, data=NT1Plots, type="a", 
       main="Session 2 ACC by Subject", auto.key = list(space='top'), xlim=(1:130), x.scales=10)

Global/Local Accuracy, All Responses

#Plot Target Location by Session
(ses1ACC=xyplot(Stimuli.ACC_mean~TargetLocation, data=fn_tlocation_bysubj_bytime, 
                groups=Subject, subset=Session=="1", auto.key = list(space="right"), 
                type=c("p","l"),main="Session 1 RT by Location"))

(ses2ACC=xyplot(Stimuli.ACC_mean~TargetLocation, data=fn_tlocation_bysubj_bytime, 
                groups=Subject, subset=Session=="2", auto.key=list(space="right"), 
                type=c("p", "l"), pch=24, main="Session 2 RT by Location"))

#key=list(space="right", column=2, points=list(pch=c(21, 24), col=c("blue", "pink", "green", "red", "yellow")), text=c(levels(fn_tlocation_bysubj_bytime$Subject), levels(fn_tlocation_bysubj_bytime$Session)) )
plot(ses2ACC+ses1ACC) #I want to learn to add symbols showing the triangles are session 2 and circles session 1 if desired

(globACC=xyplot(Stimuli.ACC_mean~Session, data=fn_tlocation_bysubj_bytime, 
                groups=Subject, subset=TargetLocation=="G", auto.key = list(space="right"), 
                type=c("p","l"),main="RT, Global"))

(locACC=xyplot(Stimuli.ACC_mean~Session, data=fn_tlocation_bysubj_bytime, 
               groups=Subject, subset=TargetLocation=="L", auto.key=list(space="right"), 
               type=c("p", "l"), pch=24, main="RT, Local"))

plot(globACC+locACC, main="Global and Local Response Times by Session") #key not functioning correctly nor is the title

#plot side by side session 1 and 2 glocal and local
xyplot(Stimuli.ACC_mean~Session|TargetLocation, data=fn_tlocation_bysubj_bytime, groups=Subject, 
       auto.key =list(space="right"), type=c("p", "l"), main="Global and Local Processing by Session")

xyplot(Stimuli.ACC_mean~TargetLocation|Session, data=fn_tlocation_bysubj_bytime, groups=Subject, 
       auto.key =list(space="right"), type=c("p", "l"), main="Global and Local Processing by Session")

#in panels by subj with regression and mean lines
mypanel=function(x,y,h){
  panel.xyplot(x, y, lty=1, type=c('p', 'l'))
  panel.lmline(x, y, lty=3, lwd=1, col="purple")
  panel.grid(h=-1, v=-1)
  panel.abline(mean(h), lty=2, col="red")
  llines(x, y, col=c("blue", "green"))
}
colors=c("blue", "green")
bysubjectGlobal=factor(fn_tlocation_stats$Subject, levels = c(1,2,3,4,5), labels = c("1", "2", "3", "4", "5"))
xyplot(Stimuli.ACC_mean~Session|bysubjectGlobal, groups=TargetLocation, data=fn_tlocation_stats, 
       h=fn_tlocation_stats$Stimuli.ACC_mean, layout=c(5,1), aspect=1.5, 
       main="Subject ACC Global v Local", xlab="Session", ylab="ACC", panel=mypanel, 
       auto.key=Tlockeylist)